package main

import (
	"fmt"
	"runtime"
	"time"
)

func main() {
	myTicker := time.NewTicker(time.Second)
	mainPrint := make(chan string)
	i := 0
	go func() {
		for {
			i++
			nowTime := <-myTicker.C
			fmt.Println("now time:", nowTime)
			if i == 8 {
				mainPrint <- "主goroutine开始"
				runtime.Goexit()
			}
		}
	}()
	fmt.Println(<-mainPrint)
}
